package com.online_vote_system.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.online_vote_system.demo.vo.Vote;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface VoteMapper extends BaseMapper<Vote> {

    @Update("update competition SET score${fg}=score${fg}+1 where com_id=#{comId}")
    void doVote(String comId, String fg);
    @Insert("insert into vote(aud_id,com_id) values(#{audId},#{comId})")
    void insertVote(String comId,String audId);
    @Select("SELECT * from vote where aud_id=#{audId} and com_id=#{comId}")
    Vote findOne(String audId,String comId);
}